/*
 * 易族智汇（北京）科技有限公司 版权所有。
 * 未经许可，您不得使用此文件。
 * 官方地址：www.javamall.com.cn
 */
package com.enation.app.javashop.core.client.fallback.system;

import com.enation.app.javashop.core.client.feignimpl.system.RegionsClientFeignImpl;
import com.enation.app.javashop.core.handler.BaseFallbackFactory;
import com.enation.app.javashop.model.member.vo.RegionVO;
import com.enation.app.javashop.model.system.dos.Regions;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.springframework.cloud.openfeign.FallbackFactory;
import org.springframework.stereotype.Component;

import java.util.List;

/**
 * @author fk
 * @version v2.0
 * @Description: 地区Client断路器
 * @date 2018/9/27 14:07
 * @since v7.0.0
 */
@Component
public class RegionsClientFallbackFactory extends BaseFallbackFactory<RegionsClientFeignImpl> implements FallbackFactory {


    @Override
    protected RegionsClientFeignImpl fallback() {
        return new RegionsClientFallback();
    }

    /**
     * @author fk
     * @version v2.0
     * @Description: 地区Client断路器
     * @date 2018/9/27 14:07
     * @since v7.0.0
     */
    @Component
    public static class RegionsClientFallback implements RegionsClientFeignImpl {

        protected final Log logger = LogFactory.getLog(this.getClass());

        @Override
        public List<Regions> getRegionsChildren(Long regionId) {

            this.logger.error("系统服务返回异常，获取子地区异常");

            return null;
        }

        @Override
        public Regions getModel(Long id) {

            this.logger.error("系统服务返回异常，获取某地区异常");

            return null;
        }

        @Override
        public List<RegionVO> getRegionByDepth(Integer depth) {

            this.logger.error("系统服务返回异常，获取某深度地区异常");

            return null;
        }
    }
}
